package com.remainder.oss.ali;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.remainder.oss.ali.core.OssStsProperties;
import com.remainder.oss.ali.server.OssAliTemplateImpl;
import com.remainder.oss.s3.core.OssTemplate;

import lombok.RequiredArgsConstructor;

/**
 * oss配置bean
 *
 * @author remainder
 * @date 2023/3/18 18:23
 **/
@Configuration
@RequiredArgsConstructor
@EnableConfigurationProperties(OssStsProperties.class)
public class OssAliAutoConfiguration {

    @Bean
    @ConditionalOnProperty(prefix = "oss.sts", name = "enable")
    public OssTemplate ossAliTemplateImpl(OssStsProperties ossStsProperties) {
        return new OssAliTemplateImpl(ossStsProperties);
    }
}
